package com.artist.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import springfox.documentation.RequestHandler;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

@Configuration
@EnableSwagger2

public class configSwagger2 {
            private ApiInfo apiInfo(){
                Contact contact=new Contact("飞天虎","http://gitee.com/feitianhuhu","253865797@qq.com");
                return new ApiInfo("Artist ApI",
                        "梦在远方",
                        "1.0",
                        "http://locahost:8081/artistdemo",
                        contact,
                        "Apache 2.0",
                        "",
                        new ArrayList());
            }

    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("邓科荣")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.artist.controller"))
                .paths(PathSelectors.any())
                .build();


  }
    @Bean
    public RequestMappingInfoHandlerMapping requestMappingInfoHandlerMapping(){
        return new RequestMappingHandlerMapping();
    }
}

